(function () {
  const Slider = function (opt) {
    this.slider = document.getElementsByClassName(opt.sliderItem)
    this.thumbs = document.getElementsByClassName(opt.thumbItem)
    $.get('/user')
    this.bindClick();
  }
  Slider.prototype = {
    bindClick: function () {
      const slideItems = this.slider;
      const thumbItems = this.thumbs;
      for (let i = 0; i < thumbItems.length; i++){
        (function (j) {
          thumbItems[i].onclick = function () {
            for (let k = 0; k < thumbItems.length; k++){
              thumbItems[k].className="thumb-item";
              slideItems[k].className="slider-item";
            }
            thumbItems[j].className = "thumb-item current";
            slideItems[j].className = "slider-item active";
          }
        })(i)
      }
    }
  }
  window.Slider = Slider;
})();

const slider = new Slider({
  sliderItem: "slider-item",
  thumbItem: "thumb-item"
})
